Update filter lists and add a suspcious-source scanner
authorXimin Luo <infinity0@debian.org>
Wed, 19 Apr 2017 22:19:35 +0000 (00:19 +0200)
committerXimin Luo <infinity0@debian.org>
Wed, 19 Apr 2017 22:19:35 +0000 (00:19 +0200)
debian/README.source
debian/deps-tarball-filter.txt
debian/deps-tarball-unsuspicious.txt [new file with mode: 0644]
debian/make_orig_multi.sh
debian/patches/clean-cargo-deps.patch

index 1c6a4d66925b5bc1e70cfc2291e4290b5942d6a9..4a2b5502aa647b8b01764a370db8c51c5a65e325 100644 (file)
@@ -1,14 +1,14 @@
 Updating the package
 ====================
 
-1. Run d/make_orig_multi.sh.
+1. Run d/make_orig_multi.sh <version>.
 2. Verify the -deps component tarball to make sure it looks good.
    If not, edit d/make_orig_multi.sh and the surrounding files (such as patches
    and exclude files) and repeat the above until it looks good.
 3. $ git fetch upstream
    You might have to first run:
    $ git remote add upstream https://github.com/rust-lang/cargo
-4. $ gbp import-orig ../cargo_0.16.0.orig.tar.gz
+4. $ gbp import-orig ../cargo_<version>.orig.tar.gz
    If you get errors, check the extra default flags in d/gbp.conf
 
 General info
index fb48e74212d31198fd475ea4d82cab2d4512c8b1..866af0016352c69d37ac0f1a2a7262d9c21152a8 100644 (file)
@@ -6,6 +6,7 @@ libgit2-sys-*/libgit2/examples/
 libgit2-sys-*/libgit2/tests/
 libssh2-sys-*/libssh2*/
 libz-sys-*/src/zlib-*/
+strsim-*/docs/
 
 # To clean deps before making a new tarball, run
 # grep -v '^#' debian/deps-tarball-filter.txt | xargs -I% sh -c 'rm -rf %'
diff --git a/debian/deps-tarball-unsuspicious.txt b/debian/deps-tarball-unsuspicious.txt
new file mode 100644 (file)
index 0000000..9f5fb74
--- /dev/null
@@ -0,0 +1,29 @@
+# This is a list of files and dirs that are omitted from our custom
+# "suspicious files" scanner
+
+# test data
+flate2-*/tests/
+tar-*/tests/archives/
+term-*/tests/data/
+toml-*/tests/
+
+# misc support data
+hamcrest-*/LICENSE-*
+*/.travis.yml
+# "build status" link-images etc take up a lot of line-length
+*/README.md
+
+# individual files, manually audited:
+idna-*/tests/IdnaTest.txt
+idna-*/src/uts46_mapping_table.rs
+regex-*/src/testdata/basic.dat
+regex-*/tests/fowler.rs
+libgit2-sys-*/libgit2/src/openssl_stream.c
+term-*/scripts/id_rsa.enc
+url-*/github.png
+num-*/doc/favicon.ico
+num-*/doc/rust-logo-128x128-blk-v2.png
+num-*/.travis/deploy.enc
+miniz-sys-*/miniz.c
+docopt-*/src/test/testcases.rs
+winapi-*/src/winnt.rs
index f8a3d5bbedc47ff2acae1b0188cba009f6a3960c..b15a6b2069968d828423d70444fa97c3ae507d6a 100755 (executable)
@@ -25,6 +25,7 @@ fi;
 
 BOOTSTRAP_PY=$(find "${PWD}" -name bootstrap.py -type f)
 DEPS_FILTER=$(find "${PWD}" -name deps-tarball-filter.txt -type f)
+DEPS_SUS_WHITELIST=$(find "${PWD}" -name deps-tarball-unsuspicious.txt -type f)
 
 # Download cargo tarball
 uscan --rename ${USCAN_ARGS} --force-download --destdir "${TMPDIR}/"
@@ -49,13 +50,31 @@ cargo vendor --explicit-version --verbose deps
 
 # Unpack artifacts and clean embedded libs
 ${WORKDIR}/debian/cargo-vendor-unpack.py
-grep -v '^#' ${DEPS_FILTER} | xargs  -I% sh -c 'rm -rf deps/%' &&
-tar -czf "${TMPDIR}/cargo_${CARGO_VER}.orig-deps.tar.gz" deps
+grep -v '^#' ${DEPS_FILTER} | xargs  -I% sh -c 'rm -rf deps/%'
+
+# Report any suspicious files
+cp -R deps deps-scan
+grep -v '^#' ${DEPS_SUS_WHITELIST} | xargs  -I% sh -c 'rm -rf deps-scan/%'
+echo "Checking for suspicious files..."
+# The following shell snippet is a bit more strict than suspicious-source(1)
+find deps-scan -type f -and -not -name '.cargo-checksum.json' -exec file '{}' \; | \
+  sed -e 's/\btext\b\(.*\), with very long lines/verylongtext\1/g' | \
+  grep -v '\b\(text\|empty\)\b' || true
+echo "The above files (if any) seem suspicious, please audit them."
+echo "If good, add them to ${DEPS_SUS_WHITELIST}."
+echo "If bad, add them to ${DEPS_FILTER}."
+rm -rf deps-scan
+
+# Pack it up, reproducibly
+GZIP=-9n tar --sort=name \
+    --mtime="./Cargo.lock" \
+    --owner=root --group=root \
+    -czf "${TMPDIR}/cargo_${CARGO_VER}.orig-deps.tar.gz" deps
 
 # All is good, we are done!
 echo "Your files are available at:"
 echo "${TMPDIR}/cargo_${CARGO_VER}.orig.tar.gz \\"
 echo "${TMPDIR}/cargo_${CARGO_VER}.orig-deps.tar.gz"
 echo ""
-echo "Unpacked cargo sources are availabe under:"
+echo "Unpacked cargo sources are available under:"
 echo "${TMPDIR}/cargo/"
index 57dd40a2d84de5f788dbd5ae54fdcd67b43b50fc..a3bea54be66ee641201803ce0cad351f59be4cfc 100644 (file)
@@ -10,7 +10,7 @@ Forwarded: not-needed
 --- a/Cargo.toml
 +++ b/Cargo.toml
 @@ -47,8 +47,8 @@
- url = "1.1"
 -[target.'cfg(windows)'.dependencies]
 -advapi32-sys = "0.2"
 -kernel32-sys = "0.2"